REBOL [
Title: "BBC News -- Headline Extractor -> HTML"
Date: 28-September-1999
File: %bbc_html.r
Purpose: {
Download the BBC News page and form a digest file
of the headlines in HTML.
Also sorts the news items into UK and World.
}
]
; Allow REBOL to write to the file without constant prompting
; (Run REBOL with -s option to avoid the prompt from this command, too)
secure none
out: %digest.html
write out "^/^/"
world: make string! 1000
uk: make string! 1000
text: read http://news.bbc.co.uk/
; Save a local copy to help with development...
write %news.html text
line: ["" any [newline | "" | ]
["} {">}
[ " " copy item to
| copy item to ""]
(if not empty? item
[either (type = "world") [str: world] [str: uk]
append str rejoin
[{} trim/lines item " ^/"]])
| none]
thru ]
parse text
[thru
some [line | newline | thru | thru ]
]
write/append out "UK^/"
write/append out uk
write/append out "World^/"
write/append out world
write/append out "^/^/"
|